#include "CorePch.h"
#include "JDebug.h"
#include <Windows.h>
namespace JJc{


#ifdef _DEBUG

//************************************
// Method:    Trace
// FullName:  JJc::JDebug::Trace
// Access:    public 
// Returns:   void
// Parameter: const wchar * output
// Description: show string to the debugger in output window.
//************************************
void JDebug::Trace( const wchar* output )
{		
    OutputDebugStringW(output);
    OutputDebugStringW(L"\n");
}


//************************************
// Method:    _outputstring
// Author:    J.J. WANG
// Description: show string to the debugger in output window.
//************************************
void JDebug::OutputString( wchar* format, ...)
{
	va_list args;
	int len;
	wchar * buffer;

	va_start( args, format );
	len = _vscwprintf( format, args ); // _vscprintf doesn't count+ 1; // terminating '\0'
	buffer = (wchar*)malloc( len * sizeof(wchar) );
	vswprintf( buffer, len, format, args );
    JDebug::Trace( buffer );
	free(buffer);
}

#else
    void JDebug::Trace( const wchar* output ){}
    void JDebug::OutputString( wchar* format, ...){}

#endif

}//end namespace	
